// 医生管理相关接口（统一 async/await 风格，支持请求头传参）
import api from '../utils/request'

const doctorApi = {
  // 修改密码
  async changeDoctorPassword(params) {
    const res = await api.post('/api/userinfo/updatePassword', params)
    return res
  },
  // 根据 userinfo_id 获取当前登录医生信息
  async getCurrentDoctor(userinfoId) {
    const res = await api.get(`/api/doctor/current/${userinfoId}`)
    return res
  },
  // 诊疗记录：获取医生专属全量数据（无分页）
  async getTreatmentList(config = {}) {
    const res = await api.get('/api/doctor/treatment/list', config)
    return res
  },
  // 诊疗记录：获取详情（带权限校验）
  async getTreatmentInfo(treatmentId, config = {}) {
    const res = await api.get(`/api/doctor/treatment/info/${treatmentId}`, config)
    return res
  },
  // 诊疗记录：新增
  async addTreatment(data, config = {}) {
    const res = await api.post('/api/doctor/treatment/add', data, config)
    return res
  },
  // 诊疗记录：编辑
  async editTreatment(data, config = {}) {
    const res = await api.post('/api/doctor/treatment/edit', data, config)
    return res
  },
  // 诊疗记录：删除
  async deleteTreatment(treatmentId, config = {}) {
    const res = await api.delete(`/api/doctor/treatment/delete/${treatmentId}`, config)
    return res
  },
  // 预约列表：获取医生专属全量预约（无分页）
  async getAppointmentList(config = {}) {
    const res = await api.get('/api/doctor/appointment/list', config)
    return res
  },
  // 药品列表：获取全量药品（无分页）
  async getDrugList() {
    const res = await api.get('/api/doctor/treatment/drug/list')
    return res
  }
}

// 导出 doctorApi 对象
export default doctorApi